.class public abstract Lcom/openfeint/internal/request/JSONRequest;
.super Lcom/openfeint/internal/request/JSONContentRequest;
.source "JSONRequest.java"


# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 15
    invoke-direct {p0}, Lcom/openfeint/internal/request/JSONContentRequest;-><init>()V

    .line 16
    return-void
.end method

.method public constructor <init>(Lcom/openfeint/internal/request/OrderedArgList;)V
    .locals 0
    .parameter "args"

    .prologue
    .line 19
    invoke-direct {p0, p1}, Lcom/openfeint/internal/request/JSONContentRequest;-><init>(Lcom/openfeint/internal/request/OrderedArgList;)V

    .line 20
    return-void
.end method


# virtual methods
.method protected onFailure(Ljava/lang/Object;)V
    .locals 4
    .parameter "responseBody"

    .prologue
    .line 46
    const v3, 0x7f040006

    invoke-static {v3}, Lcom/openfeint/internal/OpenFeintInternal;->getRString(I)Ljava/lang/String;

    move-result-object v2

    .line 48
    .local v2, exceptionMessage:Ljava/lang/String;
    if-eqz p1, :cond_0

    instance-of v3, p1, Lcom/openfeint/internal/resource/ServerException;

    if-eqz v3, :cond_0

    .line 49
    move-object v0, p1

    check-cast v0, Lcom/openfeint/internal/resource/ServerException;

    move-object v1, v0

    .line 50
    .local v1, e:Lcom/openfeint/internal/resource/ServerException;
    iget-object v2, v1, Lcom/openfeint/internal/resource/ServerException;->message:Ljava/lang/String;

    .line 52
    iget-boolean v3, v1, Lcom/openfeint/internal/resource/ServerException;->needsDeveloperAttention:Z

    if-eqz v3, :cond_0

    .line 53
    const-string v3, "ServerException"

    invoke-static {v3, v2}, Lcom/openfeint/internal/OpenFeintInternal;->log(Ljava/lang/String;Ljava/lang/String;)V

    .line 54
    invoke-static {}, Lcom/openfeint/internal/OpenFeintInternal;->getInstance()Lcom/openfeint/internal/OpenFeintInternal;

    move-result-object v3

    invoke-virtual {v3, v2}, Lcom/openfeint/internal/OpenFeintInternal;->displayErrorDialog(Ljava/lang/CharSequence;)V

    .line 58
    .end local v1           #e:Lcom/openfeint/internal/resource/ServerException;
    :cond_0
    invoke-virtual {p0, v2}, Lcom/openfeint/internal/request/JSONRequest;->onFailure(Ljava/lang/String;)V

    .line 59
    return-void
.end method

.method public onFailure(Ljava/lang/String;)V
    .locals 0
    .parameter "exceptionMessage"

    .prologue
    .line 12
    return-void
.end method

.method protected onResponse(ILjava/lang/Object;)V
    .locals 1
    .parameter "responseCode"
    .parameter "responseBody"

    .prologue
    .line 38
    const/16 v0, 0xc8

    if-gt v0, p1, :cond_1

    const/16 v0, 0x12c

    if-ge p1, v0, :cond_1

    if-eqz p2, :cond_0

    instance-of v0, p2, Lcom/openfeint/internal/resource/ServerException;

    if-nez v0, :cond_1

    .line 39
    :cond_0
    invoke-virtual {p0, p2}, Lcom/openfeint/internal/request/JSONRequest;->onSuccess(Ljava/lang/Object;)V

    .line 43
    :goto_0
    return-void

    .line 41
    :cond_1
    invoke-virtual {p0, p2}, Lcom/openfeint/internal/request/JSONRequest;->onFailure(Ljava/lang/Object;)V

    goto :goto_0
.end method

.method public onResponse(I[B)V
    .locals 3
    .parameter "responseCode"
    .parameter "bodyStream"

    .prologue
    .line 24
    array-length v1, p2

    if-eqz v1, :cond_1

    array-length v1, p2

    const/4 v2, 0x1

    if-ne v1, v2, :cond_0

    const/4 v1, 0x0

    aget-byte v1, p2, v1

    const/16 v2, 0x20

    if-eq v1, v2, :cond_1

    :cond_0
    invoke-virtual {p0}, Lcom/openfeint/internal/request/JSONRequest;->isResponseJSON()Z

    move-result v1

    if-eqz v1, :cond_2

    .line 25
    :cond_1
    invoke-virtual {p0, p2}, Lcom/openfeint/internal/request/JSONRequest;->parseJson([B)Ljava/lang/Object;

    move-result-object v0

    .line 26
    .local v0, responseBody:Ljava/lang/Object;
    invoke-virtual {p0, p1, v0}, Lcom/openfeint/internal/request/JSONRequest;->onResponse(ILjava/lang/Object;)V

    .line 31
    .end local v0           #responseBody:Ljava/lang/Object;
    :goto_0
    return-void

    .line 29
    :cond_2
    invoke-static {p1}, Lcom/openfeint/internal/request/JSONRequest;->notJSONError(I)Lcom/openfeint/internal/resource/ServerException;

    move-result-object v1

    invoke-virtual {p0, p1, v1}, Lcom/openfeint/internal/request/JSONRequest;->onResponse(ILjava/lang/Object;)V

    goto :goto_0
.end method

.method public onSuccess(Ljava/lang/Object;)V
    .locals 0
    .parameter "responseBody"

    .prologue
    .line 11
    return-void
.end method

.method protected parseJson([B)Ljava/lang/Object;
    .locals 1
    .parameter "bodyStream"

    .prologue
    .line 34
    invoke-static {p1}, Lcom/openfeint/internal/Util;->getObjFromJson([B)Ljava/lang/Object;

    move-result-object v0

    return-object v0
.end method
